<?php
require_once 'tcpdf.php';

class Evebit_Pdf_Tcpdf extends TCPDF{
	
	public $userObject;
	
	public function __construct($orientation='P', $unit='mm', $format='A4', $unicode=true, $encoding='UTF-8', $diskcache=false, $userObject = null){
		if(!$userObject){
			return false;
		} else {
			$this->userObject = $userObject;
		}
		
		parent::__construct($orientation, $unit, $format, $unicode, $encoding, $diskcache);
	}
	
 //Page header
    public function Header() {
		
        // Set font
        $this->SetFont('trebuc', '', 12);
        //$this->SetY(10);

//        $html = <<<EOF
//           <font style="color:#767070;">Business and Bling</font>
//EOF;
//        $this->writeHTML($html);
        $this->SetTextColorArray(array(118,112,112));
        $this->Cell('',13,ucwords($this->userObject->username),'',1,'L',false,'',0,true,'','B');

        $this->Cell('0','','',array(
                                   'B'=>array( 'color'=>array(118,112,112),
                                               'width'=>'0.5px'
                                        )
                                 )
                    );
    }

    // Page footer
    public function Footer() {
        // Position at 15 mm from bottom
        //$this->setFooterMargin(50);
        $this->SetY(-45);
        $this->SetX(0);
        // Set font
        $this->SetFont('trebuc', '', 12);
        $this->SetTextColorArray(array(118,112,112));
        // Page number
        //$this->Cell(0, 10, 'Page '.$this->getAliasNumPage().'/'.$this->getAliasNbPages(), 0, false, 'R', 0, '', 0, false, 'T', 'M');
        $page = $this->getAliasNumPage();
        $this->Cell('155','0','',array(
                                   'B'=>array( 'color'=>array(118,112,112),
                                               'width'=>'0.4px'
                                        )
                                 )
                    );
        $this->Cell('28','0','    '.$page,'LTR','0','C');
        
        $this->Cell('100','0','',array(
                                   'B'=>array( 'color'=>array(118,112,112),
                                               'width'=>'0.4px'
                                        )
                                 )
                    );
         
                    
         $html = <<<EOF
         <div></div>
         <br />
         <div style="font-size:35px;color:#767070;">
           <b>CONFIDENTIAL - DO NOT DISSEMINATE.</b>This business plan contains confidential, trade-secret
information and is shared only with the understanding that you will not share its contents or ideas
with third parties without the express written consent of the plan author.
          </div>
EOF;
         $this->writeHTML($html);
                
    }
}